package com.chuangke.file.model;

import java.util.List;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.chuangke.common.constant.Masks;
import com.chuangke.framework.model.BasicModel;
import com.chuangke.fss.model.FSSObject;

/**
 * @Description
 * @author stm
 * @date 2019年2月24日 下午10:06:54
 */
public class FileInfo extends BasicModel {

	
    private static final long serialVersionUID = 1L;

	public static final String TYPE_FILE = "F";
	public static final String TYPE_DIR = "D";

	private String parentId;
	private String signId ;
	private int version;
	private String name;
	private String category;
	private String isPublish;
	private String type;
	private String suffix;
	private String mimeType ;
	private long size;
	private String dirDel;
	private String dbankId;
	private String isAllSee ;
	private String isShared ;
	private String md5hex;
	private String storageType = "";
	private String storage1 = "";
	private String storage2 = "";
	private String thumStatus = Masks.BOOL_NO;
	private String thumStorage1 = "";
	private String thumStorage2 = "";
	private String indexStatus = Masks.BOOL_NO;
	private int downloadCount;
	private int downloadPeopleCount;
	private String delFlag;

	// 非数据库字段
	@TableField(exist = false)
	private String dbankName;
	@TableField(exist = false)
	private String parentName;
	@TableField(exist = false)
	private List<FileInfo> children;
	@TableField(exist = false)
	private Integer level;

	@TableField(exist = false)
	@JSONField(serialize = false)
	private byte[] content;
	
	@TableField(exist = false)
	private List<FileInfoAffix> affixList;
	
	@TableField(exist = false)
	private SysFilePermission permission ;
	
	@TableField(exist = false)
	private Integer uploadCount;
	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public String getSignId() {
		return signId;
	}

	public void setSignId(String signId) {
		this.signId = signId;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getIsPublish() {
		return isPublish;
	}

	public void setIsPublish(String isPublish) {
		this.isPublish = isPublish;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public long getSize() {
		return size;
	}

	public Integer getUploadCount() {
		return uploadCount;
	}

	public void setUploadCount(Integer uploadCount) {
		this.uploadCount = uploadCount;
	}

	public void setSize(long size) {
		this.size = size;
	}

	public String getDirDel() {
		return dirDel;
	}

	public void setDirDel(String dirDel) {
		this.dirDel = dirDel;
	}

	public String getStorageType() {
		return storageType;
	}

	public void setStorageType(String storageType) {
		this.storageType = storageType;
	}

	public String getStorage1() {
		return storage1;
	}

	public void setStorage1(String storage1) {
		this.storage1 = storage1;
	}

	public String getStorage2() {
		return storage2;
	}

	public void setStorage2(String storage2) {
		this.storage2 = storage2;
	}

	public String getThumStorage1() {
		return thumStorage1;
	}

	public void setThumStorage1(String thumStorage1) {
		this.thumStorage1 = thumStorage1;
	}

	public String getThumStorage2() {
		return thumStorage2;
	}

	public void setThumStorage2(String thumStorage2) {
		this.thumStorage2 = thumStorage2;
	}

	public String getThumStatus() {
		return thumStatus;
	}

	public void setThumStatus(String thumStatus) {
		this.thumStatus = thumStatus;
	}

	public String getIndexStatus() {
		return indexStatus;
	}

	public void setIndexStatus(String indexStatus) {
		this.indexStatus = indexStatus;
	}

	public String getSuffix() {
		return suffix;
	}

	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}


	public String getDbankId() {
		return dbankId;
	}

	public void setDbankId(String dbankId) {
		this.dbankId = dbankId;
	}

	public String getIsAllSee() {
		return isAllSee;
	}

	public void setIsAllSee(String isAllSee) {
		this.isAllSee = isAllSee;
	}

	public String getIsShared() {
		return isShared;
	}

	public void setIsShared(String isShared) {
		this.isShared = isShared;
	}

	public int getDownloadCount() {
		return downloadCount;
	}

	public void setDownloadCount(int downloadCount) {
		this.downloadCount = downloadCount;
	}

	public int getDownloadPeopleCount() {
		return downloadPeopleCount;
	}

	public void setDownloadPeopleCount(int downloadPeopleCount) {
		this.downloadPeopleCount = downloadPeopleCount;
	}

	public String getMd5hex() {
		return md5hex;
	}

	public void setMd5hex(String md5hex) {
		this.md5hex = md5hex;
	}

	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}

	public String getDbankName() {
		return dbankName;
	}

	public void setDbankName(String dbankName) {
		this.dbankName = dbankName;
	}

	public String getParentName() {
		return parentName;
	}

	public void setParentName(String parentName) {
		this.parentName = parentName;
	}

	public List<FileInfo> getChildren() {
		return children;
	}

	public void setChildren(List<FileInfo> children) {
		this.children = children;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public byte[] getContent() {
		return content;
	}

	public void setContent(byte[] content) {
		this.content = content;
	}

	public String getMimeType() {
		return mimeType;
	}

	public void setMimeType(String mimeType) {
		this.mimeType = mimeType;
	}

	public List<FileInfoAffix> getAffixList() {
		return affixList;
	}

	public void setAffixList(List<FileInfoAffix> affixList) {
		this.affixList = affixList;
	}

	public SysFilePermission getPermission() {
		return permission;
	}

	public void setPermission(SysFilePermission permission) {
		this.permission = permission;
	}

	public FSSObject convert() {
		FSSObject fssObject = new FSSObject();
		fssObject.setName(this.getName());
		fssObject.setSize(this.getSize());
		fssObject.setSuffix(this.getSuffix());
		fssObject.setStorageType(this.getStorageType());
		fssObject.setStorage1(this.getStorage1());
		fssObject.setStorage2(this.getStorage2());
		fssObject.setMd5hex(this.getMd5hex());
		fssObject.setMimeType(this.getMimeType());

		return fssObject;
	}

	public void convert(FSSObject fssObject) {
		this.setStorage1(fssObject.getStorage1());
		this.setStorage2(fssObject.getStorage2());
		this.setStorageType(fssObject.getStorageType());
	}

	public FileInfoVersion convertToFileInfoVersion() {
		FileInfoVersion fileInfoVersion = new FileInfoVersion();
		fileInfoVersion.setId(this.getId());
		fileInfoVersion.setSignId(this.getSignId());
		fileInfoVersion.setName(this.getName());
		fileInfoVersion.setType(this.getType());
		fileInfoVersion.setSize(this.getSize());
		fileInfoVersion.setStorageType(this.getStorageType());
		fileInfoVersion.setStorage1(this.getStorage1());
		fileInfoVersion.setStorage2(this.getStorage2());
		fileInfoVersion.setSuffix(this.getSuffix());
		fileInfoVersion.setDownloadCount(this.getDownloadCount());
		fileInfoVersion.setDownloadPeopleCount(this.getDownloadPeopleCount());
		fileInfoVersion.setVersion(this.getVersion());
		fileInfoVersion.setMd5hex(this.getMd5hex());
		fileInfoVersion.setThumStatus(this.getThumStatus());
		fileInfoVersion.setThumStorage1(this.getThumStorage1());
		fileInfoVersion.setThumStorage2(this.getThumStorage2());
		fileInfoVersion.setIndexStatus(this.getIndexStatus());
		fileInfoVersion.setMimeType(this.getMimeType());
		return fileInfoVersion;
	}
	
}
